home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / Bomber Bob.swf / scripts / DefineSprite_62 / frame_2 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  1.8 KB  |  108 lines

  1. stop();
  2. speed = 0;
  3. cont = 0;
  4. this.onEnterFrame = function()
  5. {
  6.    cont2++;
  7.    if(cont2 % 3 == 0)
  8.    {
  9.       if(Key.isDown(32))
  10.       {
  11.          _root.gl.duplicateMovieClip("gl" + cont,cont);
  12.          _root["gl" + cont].gotoAndPlay(1);
  13.          _root["gl" + cont]._rotation = _root.plane._rotation;
  14.          _root["gl" + cont]._x = _root.plane._x + 10;
  15.          _root["gl" + cont]._y = _root.plane._y;
  16.          cont++;
  17.       }
  18.    }
  19.    if(cont > 100)
  20.    {
  21.       cont = 0;
  22.    }
  23.    if(_Y + speed > 20)
  24.    {
  25.       _Y = _Y + speed;
  26.    }
  27.    else
  28.    {
  29.       speed = Math.abs(speed);
  30.    }
  31.    if(_Y + speed < 340)
  32.    {
  33.       _Y = _Y + speed;
  34.    }
  35.    else
  36.    {
  37.       speed = - Math.abs(speed);
  38.    }
  39.    if(_X + speeX > 80)
  40.    {
  41.       _X = _X + speedX;
  42.    }
  43.    else
  44.    {
  45.       speedX = Math.abs(speedX);
  46.    }
  47.    if(_X + speed < 530)
  48.    {
  49.       _X = _X + speedX;
  50.    }
  51.    else
  52.    {
  53.       speedX = - Math.abs(speedX);
  54.    }
  55.    _X = _X + speedX;
  56.    if(Key.isDown(38))
  57.    {
  58.       speed = -3;
  59.       if(_rotation > -60)
  60.       {
  61.          _rotation = _rotation - 4;
  62.       }
  63.    }
  64.    else if(Key.isDown(40))
  65.    {
  66.       speed = 3;
  67.       if(_rotation < 60)
  68.       {
  69.          _rotation = _rotation + 4;
  70.       }
  71.    }
  72.    else if(speed > 0)
  73.    {
  74.       speed -= 0.5;
  75.    }
  76.    else if(speed < 0)
  77.    {
  78.       speed += 0.5;
  79.    }
  80.    if(Key.isDown(37))
  81.    {
  82.       speedX = -3;
  83.    }
  84.    else if(Key.isDown(39))
  85.    {
  86.       speedX = 3;
  87.    }
  88.    else if(speedX > 0)
  89.    {
  90.       speedX -= 0.25;
  91.    }
  92.    else if(speedX < 0)
  93.    {
  94.       speedX += 0.25;
  95.    }
  96.    if(!Key.isDown(38) && !Key.isDown(40))
  97.    {
  98.       if(_rotation > 0)
  99.       {
  100.          _rotation = _rotation - 4;
  101.       }
  102.       else if(_rotation < 0)
  103.       {
  104.          _rotation = _rotation + 4;
  105.       }
  106.    }
  107. };
  108.